import { _brandDetail, _goodsList } from "../../service/api";
Page({
  data: {
    id: null,
    page: 1,
    size: 20,
    brand: {},
    goodsList: [],
  },
  onLoad: function (options) {
    this.setData({ id: options.id });
    this.initData();
  },
  async initData() {
    const brand = await _brandDetail({ id: this.data.id });
    this.setData({ brand });
    this.getGoodsList();
  },
  async getGoodsList() {
    const { id, page, size } = this.data;
    const result = await _goodsList({ brandId: id, page, size });
    this.setData({ goodsList: result.data });
  },
});
